home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
UTIL
/
MEMORY
/
OLD
/
MEM208SRC
/
FSLib
/
c
/
util
< prev
Wrap
Text File
|
1993-08-22
|
2KB
|
91 lines
/* Original code (c) Acorn Computers Ltd, 1992-3 */
/* $Id: c.util 3.1 93/03/09 20:11:48 brian Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "kernel.h"
#include "interface.h"
#include "util.h"
#include "swis.h"
#include <stdarg.h>
DEFERR(mb_BadParameters,0x100DC,"Bad parameters");
DEFERR(mb_FileNotFound,0x100D6,"not found");
DEFERR(mb_EOF,0xDF,"End of file");
char *special_field;
/*
* Generic routines
*/
void StampInfo
( Information_Fields *info )
{
int time[2];
time[0]=3;
time[1]=0;
_kernel_osword(14,time);
if ( info->date_type.part_1>>20 != -1 )
info->date_type.part_1 = 0xfffffd00;
info->date_type.part_1&=~0xff;
info->date_type.part_1|=time[1];
info->date_type.part_2=time[0];
}
int readwidth
( void )
{
int iblk[2];
int width;
_kernel_swi_regs regs;
iblk[0] = VduVariable_WindowWidth;
iblk[1] = -1;
regs.r[0] = ( int )&iblk;
regs.r[1] = ( int )&width;
_kernel_swi( OS_ReadVduVariables, ®s, ®s );
return width;
}
#include <ctype.h>
int stricmp( const char *s1, const char *s2 )
/* case independent string compare */
{
int n = 0;
while ( (n=toupper(*s1)-toupper(*s2))==0 && *s1 )
++s1,++s2;
return n;
}
int strnicmp( const char *s1, const char *s2, int l )
/* case independent string compare */
{
int n = 0;
while ( l-- && (n=toupper(*s1)-toupper(*s2))==0 && *s1 )
++s1,++s2;
return n;
}
void strins(char *d, const char *s )
/* Insert string s at the beginning of string d */
{
int l=strlen(s);
int m=strlen(d);
memmove(&d[l],d,m+1);
memmove(d,s,l);
}
/*{{{ char *strdup*/
char *strdup
( const char *d )
{
int m=strlen(d);
char *p = malloc(m+1);
if (p)
strcpy( p, d );
return p;
}
/*}}} */